'use strict';
var React = require('react');
var ReactRedux = require('react-redux');
var actions=require('../../actions/commonDetail.js');

class HkfsCommonDetail extends React.Component {
    constructor(props) {
        super(props);
    }


    createMarkup(content) {
        return {__html: content};
    };

    componentDidMount(){
        var UrlInformation=require('../../common/CommonUrlOperation.js');
        this.props.dispatch(actions.getArticleDetail(UrlInformation.getParametersObj()['id']));
    }

    render() {
        return <div className="HkfsCommonDetailContainer">
            <div className="HkfsCommonDetailAllContent">
                <div className="HkfsCommonDetailHeader">
                    <div className="HkfsCommonDetailTitle">{this.props.detailContent.title}</div>
                    <div className="HkfsCommonDetailTime"><span>更新时间&nbsp;&nbsp;&nbsp;</span><span>{this.props.detailContent.ctsLongStr}</span></div>
                </div>
                <div className="HkfsCommonDetailContent" dangerouslySetInnerHTML ={this.createMarkup(this.props.detailContent.contentStr)}></div>
            </div>
        </div>
    }
}


function mapStateToProps(state) {
    return Object.assign({}, state.detailMessage);
}

module.exports = ReactRedux.connect(mapStateToProps)(HkfsCommonDetail);